// 引入request
import request from '../util/request.js';
import config from '../util/config.js';
const machineryTypeRequest = {
    BASE_URL : config.dvUrl + "/dv",
    // 请求过程在这里开发，不在.vue文件中开发
    /**
     * 多条件分页查询subjectType列表
     * @param subject
     * @param callBack
     */
    loadMachineryType(machineryType, callBack){
        // 拼接url  /sys/queryByPage?xxx
        let url = this.BASE_URL + "/machineryType/query";
        // 调用request进行请求  http://lcation
        request.get(url,machineryType,callBack);
    },
    queryMachineryTypeNames(callBack){
        let url = this.BASE_URL + "/machineryType/queryMachineryTypeNames";
        request.get(url,null,callBack);
    },
    /**
     * 新增设备类型的API
     * @param subject
     * @param callBack
     */
    addMachineryType(machineryType,callBack){
        let url = this.BASE_URL + "/machineryType/save"
        request.post(url,machineryType,callBack);
    },
    /**
     * 通过id加载设备类型信息的API
     * @param subject
     * @param callBack
     */
    getById(machineryTypeId,callBack){
        let url = this.BASE_URL + "/machineryType/queryById?machineryTypeId=" + machineryTypeId;
        request.get(url,null,callBack);
    },

    // queryToolTypeNames(callBack){
    //     let url = this.BASE_URL + "/toolType/queryToolTypeNames";
    //     request.get(url,null,callBack);
    // },

    /**
     * 修改设备类型信息的API
     * @param subject
     * @param callBack
     */
    updateMachineryType(machineryType,callBack){
        let url = this.BASE_URL + "/machineryType/update";
        request.post(url,machineryType,callBack);
    },
    /**
     *  删除设备类型的API
     * @param machineryType
     * @param callBack
     */
    deleteMachineryType(machineryTypeId,callBack){
        request.get(this.BASE_URL + "/machineryType/delete?machineryTypeId=" + machineryTypeId,null,callBack);
    },
    /**
     * 批量删除设备类型的API
     * @param subjectTypeIds
     * @param callBack
     */
    // deleteMachineryTypes(subjectIds,callBack){
    //     let url = this.BASE_URL + "/subject/deletes?a=1";
    //     for (let i = 0; i < subjectIds.length; i++){
    //         url += "&subjectIds="+subjectIds[i];
    //     }
    //     request.get(url,null,callBack);
    // }
}
// 导出我们申明的dictrequest对象
export default machineryTypeRequest;